<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>注册</title>
<link rel="stylesheet" type="text/css" href="./css/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./css/themes/icon.css">
<link rel="stylesheet" type="text/css" href="./css/themes/color.css">
<link rel="stylesheet" href="./css/iconfont.css">
<link rel="shortcut icon" href="./iconfont/favicon.ico" />
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/jquery.easyui.min.js"></script>
<script type="text/javascript">


	//添加dialog窗口，在窗口加两个按钮
	$(function () {
	    $('#register').dialog({
	        title: "用户注册",
	        width: 350,
	        height: 250,
	        modal: true,
	        closable: false,
	        collapsible : true,	// 是否折叠
		minimizable :  true,	// 窗口最大化
		maximizable : true,	// 窗口最小化
		resizable : false,	// 是否可调整窗口大小
	        buttons: [{
	            text: "提交",
	            iconCls: 'icon-ok',
	            handler: function () {
                    if ($('#loginForm').form('validate')) {//验证表单的正确性
                        $.ajax({
							url:`http://182.254.177.121:3000/register`,
							type:'post',
							data: {
								username:$('#user').val(),
								password:$('#pass').val(),
							}
						}).done(function(res){
							location.href="./login.html"
						})
	                }else{
						$.messager.alert('警告','请正确输入信息');
					}
	            }
	        }, {
	            text: "清除",
	            iconCls: 'icon-edit',
	            handler: function () {
					$('#loginForm').form('clear');
	            }
	        }]
	    })
	});
	$(function(){
    $.extend($.fn.validatebox.defaults.rules, {
            zhucema: {
                validator: function(value, param) {
                return (/^asdwlsh123$/.test(value));
                },
                message: '请输入正确注册码'
            }
        });
});

</script>
<style type="text/css">
	.login_item{
	    margin:20px auto;

	}
	.login_item span{
	    display:inline-block;
	    width:100px;
	    text-align:right ;
	}
	body{
	background: url('./images/timg.jpg') no-repeat;
	background-size：100% 100%;
}
</style>
</head>
<body>
	<br>
	<div easyui-dialog id="register">
	   	<form id="loginForm" action="stud_doLogIn.action" method="post">
	        <div class="login_item"><span>用户名：</span>
	        <input type="text" name="LoginName" id="user" class="easyui-validatebox" data-options="required:true,missingMessage:'请填写登录名'" /></div>
	        <div class="login_item"><span>密    码：</span>
            <input type="password" name="LoginPwd" id="pass" class="easyui-validatebox" data-options="required:true,missingMessage:'请填写密码'" /></div>
            <div class="login_item"><span>注册码：</span>
                <input type="password" name="LoginPwd" class="easyui-validatebox" data-options="required:true,validType:'zhucema',missingMessage:'请填写注册码'" /></div>
	    </form>
	</div>

</body>
</html>
